// components/authorization/index.js
Component({
  data: {
    isLogin: false
  },
  lifetimes: {
    attached () {
      const isLogin = !!getApp().token
      const router = getCurrentPages().pop()
      console.log(router)
      if (!isLogin) {
        wx.redirectTo({
          url: '/pages/login/index?router=' + router.route
        })
      }
      this.setData({ isLogin })
    }
  }
})
